const { Service } = require('egg');

class BillService extends Service {
    async create({ type, time, amount, tag, mark }) {
        let sql =
            'insert into bill (type, time, amount, tag, mark) values (?, ?, ?, ?, ?)';
        let params = [type, time, amount, tag, mark];
        let res = await this.app.mysql.query(sql, params);
        return res;
    }

    async readList() {
        let sql = 'select * from bill';
        let res = await this.app.mysql.query(sql);
        return res;
    }
}

module.exports = BillService;
